<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<input type="button" value="按钮" onclick="fn2('刘备',20)">

<script>
    //单行注释 Ctrl+/
    /*多行注释 Ctrl+shift+/ */

    //无参无返回值
    function fn1() {
        alert("fn1")
    }
    //调用方法
    // fn1();

    //有参无返回值
    function fn2(name,age) {
        alert(name+":"+age)
    }
    // fn2("司马懿",20);
    //无参有返回值
    function fn3() {
        return"这是返回值";
    }
    let msg = fn3();
    // alert(msg)

    //有参有返回值
    function fn4(x,y) {
        return x*y;
    }
    let resule = fn4(5,9);
    // alert(resule);

    //第二种声明方法的方式
    let fn5 = function (name,age){
        alert(name+":"+age);
    }
    // fn5("诸葛亮",30);

    //第三种声明方法的方式
    let  fn6 = new Function("name","age","alert(name+':'+age)");
    fn6("貂蝉","60");

</script>
</body>
</html>